<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Auth;
use View;
use DB;
class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {

        //视图间共享数据
        session_start(); 

        if(!empty($_SESSION['user_id'])){
        $id = $_SESSION['user_id'];
        $info = DB::table('userdetail')->where('id','=',$id)->first();
            View::share('info',$info);
        }
        
    
        $config = DB::table('config')->first();
        View::share('config',$config);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
